<template>
  <div class="demo">
    <button @click="sendStudent">传递学生</button>
  </div>
</template>

<script>
import pubsub from "pubsub-js";
export default {
  name:"Student",
  data() {
    return {
      students:[
        {id:'01',name:'lisi',age:18},
        {id:'02',name:'wangwu',age:28},
        {id:'03',name:'tom',age:23},
        {id:'04',name:'jerry',age:22}
      ]
    }
  },
  methods: {
    sendStudent() {
      pubsub.publish('hello',this.students)
    }
  },
}
</script>


<style scoped>
  .demo {
    background-color: skyblue;
  }
</style>